package com.java.crazy.part17.net;

import com.java.crazy.base.BaseClass;

import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.io.PrintStream;
import java.net.Socket;

public class ClientThread extends BaseClass implements Runnable {
    private Socket socket = null;
    private BufferedReader bufferedReader = null;

    public ClientThread(Socket socket) throws IOException {
        this.socket = socket;
        bufferedReader = new BufferedReader(new InputStreamReader(socket.getInputStream()));
    }

    @Override
    public void run() {
        try {
            String msg = null;
            while ((msg = bufferedReader.readLine()) != null) {
                logi(msg);
            }
        } catch (Exception e) {
            e.printStackTrace();
        }

    }
}
